﻿using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Windows;
using Caliburn.Micro;
using JY.Wpf.Core.Tools;

namespace JY.Wpf.Core.Models
{
    /// <summary>
    /// 系统菜单
    /// </summary>
    public class SystemMenu: PropertyChangedBase
    {
        #region # 构造器
        /// <summary>
        /// 构造器
        /// </summary>
        /// <param name="number">菜单编号</param>
        /// <param name="name">菜单名称</param>
        /// <param name="url">连接地址</param>
        /// <param name="icon">图标</param>
        /// <param name="sort">菜单排序</param>
        public SystemMenu(string number, string name, string url, string icon, int sort)
        {
            this.Number = number;
            this.Name = name;
            this.Url = url;
            this.Icon = icon;
            this.Sort = sort;
            this.SubMenus = new ObservableCollection<SystemMenu>();
        }
        /// <summary>
        /// 构造器
        /// </summary>
        /// <param name="name">菜单名称</param>
        public SystemMenu(string name)
        {
            this.Name = name;
            this.SubMenus = new ObservableCollection<SystemMenu>();
        }
        /// <summary>
        /// 构造器
        /// </summary>
        /// <param name="name">菜单名称</param>
        /// <param name="url">连接地址</param>
        /// <param name="icon">图标</param>
        public SystemMenu(string name, string url, string icon)
        {
            this.Name = name;
            this.Url = url;
            this.Icon = icon;
            this.SubMenus = new ObservableCollection<SystemMenu>();
        }
        #endregion

        #region # 属性
        #region 排序——int Sort
        private int _sort;
        /// <summary>
        /// 排序
        /// </summary>
        public int Sort
        {
            get { return this._sort; }
            set { this._sort = value; base.NotifyOfPropertyChange(); }
        }
        #endregion

        #region 编号——string Number
        private string _number;
        /// <summary>
        /// 编号
        /// </summary>
        public string Number
        {
            get { return this._number; }
            set { this._number = value; base.NotifyOfPropertyChange(); }
        }
        #endregion

        #region 名称——string Name 
        private string _name;
        /// <summary>
        /// 名称
        /// </summary>
        public string Name
        {
            get { return this._name; }
            set { this._name = value; base.NotifyOfPropertyChange(); }
        }
        #endregion

        #region 页面地址——string Url
        private string _url;
        /// <summary>
        /// 页面地址
        /// </summary>
        public string Url
        {
            get { return this._url; }
            set { this._url = value; base.NotifyOfPropertyChange(); }
        }
        #endregion

        #region 图标——string Icon
        private string _icon;
        /// <summary>
        /// 图标
        /// </summary>
        public string Icon
        {
            get { return this._icon; }
            set { this._icon = value; base.NotifyOfPropertyChange(); }
        }
        #endregion

        #region 颜色——string ColorBrushStr
        private string _colorBrushStr;
        /// <summary>
        /// 颜色
        /// </summary>
        public string ColorBrushStr
        {
            get { return this._colorBrushStr; }
            set { this._colorBrushStr = value; base.NotifyOfPropertyChange(); }
        }
        #endregion

        #region 消息数量——int MsgCount
        private int _msgCount;
        /// <summary>
        /// 消息数量
        /// </summary>
        public int MsgCount
        {
            get { return this._msgCount; }
            set { this._msgCount = value; base.NotifyOfPropertyChange(); base.NotifyOfPropertyChange(() => this.MsgCountVisibility); }
        }
        #endregion

        #region 消息数量显示——Visibility MsgCountVisibility
        /// <summary>
        /// 消息数量显示
        /// </summary>
        public Visibility MsgCountVisibility
        {
            get { return this.MsgCount > 0 ? Visibility.Visible : Visibility.Collapsed; }
        }
        #endregion

        #region 子菜单集合——List<SystemMenu> SubMenus
        private ObservableCollection<SystemMenu> _subMenus;
        /// <summary>
        /// 子菜单集合
        /// </summary>
        public ObservableCollection<SystemMenu> SubMenus
        {
            get { return this._subMenus; }
            set { this._subMenus = value; base.NotifyOfPropertyChange(); }
        }
        #endregion 
        #endregion
    }
}
